package com.victorvieux.android.vlcmote;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class PlayListAdapter extends BaseAdapter {
    private Context context;
    private List<leaf> itemLists;
    private int color;
    private int size;

    
    private class ItemList extends TextView {
    	public ItemList(Context context, String text, int color, int size) {
    		super(context);
    		setPadding(0,5,0,5);
    		setText(text);
    		setTextColor(color);
    		setTextSize(size);
    	}
    };

    public PlayListAdapter(Context context, List<leaf> l, int color, int size) { 
        this.context = context;
        this.itemLists = l;
        this.color = color;
        this.size = size;
    }
    
    public int getCount() {                        
        return itemLists.size();
    }

    public Object getItem(int position) {     
        return itemLists.get(position);
    }

    public long getItemId(int position) {  
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) { 
        leaf l = itemLists.get(position);
        return new ItemList(this.context, l.getName(), this.color, this.size);
    }
}